<?php

/*
*/

class msgindexModel extends Model
{
	private $tb='msgindex';


	/*
	获取所有index
	*/
	public function getallindex($uid)
	{
		$sql="select * from $this->tb where uid=$uid";
		return $this->db->getAll($sql);
	}

	/*
	批量获取index
	*/

	public function getsomeindex($uid,$type,$arr)
	{
		$sql="select senderid,readid from $this->tb where type=$type and uid=$uid and senderid in(".rtrim(implode(',',array_values($arr)),',').")";
		return $this->db->getAll($sql);
	}

	/*
	修改index
	*/

	public function setindex($uid,$senderid,$type,$readid)
	{
		$sql="update $this->tb set readid=$readid where uid=$uid and senderid=$senderid and type=$type";
		return $this->db->set_query($sql);
	}
}